-
Notifications
You must be signed in to change notification settings - Fork 248
refactor(store): replace go-header store by ev-node store #3036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest Buf updates on your PR. Results from workflow CI / buf-check (pull_request).
|
|
Claude finished @julienrbrt's task in 2m 18s —— View job Comprehensive Code ReviewI've completed a thorough analysis of this PR that refactors the store layer to replace go-header's default store with ev-node's unified store. Overall, this is a well-architected refactoring that successfully eliminates data duplication. However, I've identified several important issues and areas for improvement. Critical Issues1. Race Condition in
|
Summary of ChangesHello @julienrbrt, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the node's data storage strategy by centralizing all block-related data within the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request successfully refactors the store integration for go-header by introducing DataStoreAdapter and HeaderStoreAdapter. This change eliminates data duplication by allowing the go-header P2P infrastructure to directly utilize the ev-node store. The rollback commands have been updated to reflect this unified store approach, and comprehensive tests have been added for the new adapter implementations. This is a significant improvement in architecture and efficiency.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3036 +/- ##
==========================================
+ Coverage 55.35% 56.01% +0.66%
==========================================
Files 117 117
Lines 11689 11843 +154
==========================================
+ Hits 6470 6634 +164
+ Misses 4496 4479 -17
- Partials 723 730 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // For ev-node, this is typically the genesis/initial height. | ||
| // If pruning has occurred, it walks up from initialHeight to find the first available item. | ||
| // TODO(@julienrbrt): Optimize this when pruning is enabled. | ||
| func (a *StoreAdapter[H]) Tail(ctx context.Context) (H, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is O(1) for non pruned node, and O(n) for pruned nodes, so we should improve this by saving the pruned tail in state in #2984
| var errElapsedHeight = errors.New("elapsed height") | ||
|
|
||
| // defaultPendingCacheSize is the default size for the pending headers/data LRU cache. | ||
| const defaultPendingCacheSize = 1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should leave enough header/data for p2p syncing nodes before they executes the block.
We can think of making it bigger otherwise.
tac0turtle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need to do writetostoreandbroadcast in the sync loop if we have this ?
We shouldn't need it indeed 👍 |
| // eliminating the need for a separate go-header store and reducing data duplication. | ||
| // | ||
| // The adapter maintains an in-memory cache for items received via P2P (through Append). | ||
| // This cache allows the go-header syncer and P2P handler to access items before they |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we worried about syncing data that doesnt apply to us then distributing it around?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could we? We distribute WriteToStoreAndBroadcast is still the one distributing.
EDIT: checking if we don't shortcut header verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirming it is done at processing: https://github.com/celestiaorg/go-header/blob/3ab204c9348645a511ef744230a7a4d213077a85/p2p/session.go#L269-L285, so we don't skip any logic
tac0turtle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
Overview
Attempt to replace go-header default store by ev-node store.
This avoids duplication of blocks.